<template>
  <div class="goods-info" v-if="Object.keys(detailInfo).length">
    <div class="info-desc clear-fix">
      <div class="start"/>
      <div class="desc">{{detailInfo.desc}}</div>
      <div class="end"/>
    </div>
    <div class="info-list">
      <img v-for="(item, index) in detailImages" :src="item" @load="imgLoad(index)">
    </div>
  </div>
</template>

<script>
  export default {
    name: "DetailGoodsInfo",
    props: {
      detailInfo: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    computed: {
      detailImages() {
        return this.detailInfo.detailImage[0].list
      }
    },
    methods: {
      imgLoad() {
        this.$emit('goodsImgLoad')
      }
    },
  }
</script>

<style scoped>
  .goods-info {
    padding: 20px 0;
    border-bottom: 5px solid #f2f5f8;
    background-color: var(--color-background);
  }

  .info-desc {
    padding: 0 15px;
  }

  .info-desc .start, .info-desc .end {
    width: 90px;
    height: 1px;
    background-color: #a3a3a5;
    position: relative;
  }

  .info-desc .start {
    float: left;
  }

  .info-desc .end {
    float: right;
  }

  .info-desc .start::before, .info-desc .end::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: #333;
    bottom: 0;
  }

  .info-desc .end::after {
    right: 0;
  }

  .info-desc .desc {
    padding: 15px 0;
    font-size: 14px;
  }

  .info-list img {
    width: 100%;
  }

</style>